/*
 * @Author: reeve reeve.lee@qq.com
 * @Date: 2024-04-06 15:02:16
 * @LastEditors: reeve reeve.lee@qq.com
 * @LastEditTime: 2024-04-18 14:59:23
 * @FilePath: \test\inc\SC92F725x_C.H
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/*--------------------------------------------------------------------------
SC92F725x_C.H

C Header file for SC92F725x microcontroller.
Copyright (c) 2018 Shenzhen SinOne Chip Electronic CO., Ltd.
All rights reserved.
��������Ԫ΢���ӹɷ����޹�˾
�汾��:  V1.0    
����:  2018.04.25
--------------------------------------------------------------------------*/
#ifndef _SC92F725x_H_
#define _SC92F725x_H_

/* ------------------- �ֽڼĴ���-------------------- */
///*CPU*/
sfr   ACC	= 0xE0;		//�ۼ�����
sfr   B	    = 0xF0;		//ͨ�üĴ���B		
sfr   PSW	= 0xD0;		//����״̬��		
sfr   DPH	= 0x83;	    //����ָ���8λ		
sfr   DPL	= 0x82;		//����ָ���8λ		
sfr   SP	= 0x81;		//��ջָ��			

/*system*/
sfr   PCON	= 0x87;	  	//��Դ�������ƼĴ���

/*interrupt*/
sfr   IP1   = 0XB9;     //�ж����ȼ����ƼĴ���1
sfr   IP    = 0xB8;	    //�ж�����Ȩ���ƼĴ���
sfr   IE    = 0xA8;	    //�жϿ��ƼĴ���
sfr   IE1   = 0XA9;    	//�жϿ��ƼĴ���1

/*PORT*/
sfr   P2PH	= 0xA2;		//P2��ģʽ���ƼĴ���0		
sfr	  P2CON = 0xA1;		//P2��ģʽ���ƼĴ���1		
sfr   P2	= 0xA0;		//P2�����ݼĴ���
sfr   P1PH  = 0x92;		//P1��ģʽ���ƼĴ���0		
sfr	  P1CON	= 0x91;		//P1��ģʽ���ƼĴ���1	
sfr   P1	= 0x90;		//P1�����ݼĴ���
sfr	  P0PH	= 0x9B;		//P0��ģʽ���ƼĴ���1		
sfr	  P0CON = 0x9A;		//P0��ģʽ���ƼĴ���1		
sfr   P0	= 0x80;		//P0�����ݼĴ���
sfr   IOHCON= 0x97;		//IOH���üĴ���

/*TIMER*/
sfr   TMCON   = 0x8E;   //��ʱ��Ƶ�ʿ��ƼĴ���
sfr   TH1	  = 0x8D;   //��ʱ��1��8λ
sfr   TH0	  = 0x8C;	//��ʱ��0��8λ
sfr   TL1	  = 0x8B;	//��ʱ��1��8λ
sfr   TL0  	  = 0x8A;	//��ʱ��0��8λ
sfr   TMOD	  = 0x89;	//��ʱ������ģʽ�Ĵ���
sfr   TCON	  = 0x88;	//��ʱ�����ƼĴ���
sfr   T2CON   = 0XC8;   //��ʱ��2���ƼĴ���
sfr   T2MOD   = 0XC9; 	//��ʱ��2����ģʽ�Ĵ���
sfr   RCAP2L  = 0XCA;   //��ʱ��2����/��׽��8λ
sfr   RCAP2H  = 0XCB;   //��ʱ��2����/��׽��8λ
sfr   TL2     = 0XCC;   //��ʱ��2��8λ
sfr   TH2     = 0XCD;   //��ʱ��2��8λ


/*ADC*/
sfr	  ADCCFG0 = 0xAB;	//P1��ADC�������üĴ���/�ο���ѹ
sfr	  ADCCFG1 = 0xAC;	//P1��ADC�������üĴ���/�ο���ѹ
sfr   ADCCON  = 0XAD;   //ADC���ƼĴ���
sfr   ADCVL	  = 0xAE;	//ADC ����Ĵ���
sfr   ADCVH	  = 0xAF;	//ADC ����Ĵ���

/*PWM*/
sfr   PWMCFG0 = 0xD1;   //PWM���üĴ���

sfr   PWMCON  = 0xD2;	//PWM���ƼĴ���
sfr   PWMPRD  = 0xD3;	//PWM�������üĴ���
sfr   PWMCFG1 = 0xD4;	//PWM���üĴ���
sfr   PWMDTY0 = 0xD5;	//PWMռ�ձ����üĴ���
sfr   PWMDTY1 = 0XD6;	//PWMռ�ձ����üĴ���
sfr	  PWMDTY2 = 0XD7;	//PWMռ�ձ����üĴ���
sfr   PWMDTY3 = 0xDD;	//PWMռ�ձ����üĴ���
sfr	  PWMDTY4 = 0XDE;	//PWMռ�ձ����üĴ���
sfr	  PWMDTY5 = 0XDF;	//PWMռ�ձ����üĴ���

///*WatchDog*/
sfr	  BTMCON  = 0XCE;   //��Ƶ��ʱ�����ƼĴ���
sfr   WDTCON  = 0xCF;   //WDT���ƼĴ���

/*LCD*/
sfr   OTCON   = 0X8F;	//LCD��ѹ������ƼĴ���
sfr   P0VO    = 0X9C;   //P0 LCD Bais ����Ĵ���

/*INT*/
sfr   INT0F   = 0XBA; 	//INT0 �½����жϿ��ƼĴ���
sfr   INT0R   = 0XBB; 	//INT0 �Ͻ����жϿ��ƼĴ���
sfr   INT2F   = 0XC6; 	//INT2 �½����жϿ��ƼĴ���
sfr   INT2R   = 0XC7; 	//INT2 �Ͻ����жϿ��ƼĴ���

/*IAP */
sfr	  IAPCTL  = 0xF6;	//IAP���ƼĴ���
sfr	  IAPDAT  = 0xF5;	//IAP���ݼĴ���
sfr   IAPADE  = 0xF4;   //IAP��չ��ַ�Ĵ���
sfr	  IAPADH  = 0xF3;	//IAPд���ַ��λ�Ĵ���
sfr	  IAPADL  = 0xF2;	//IAPд���ַ��8λ�Ĵ���
sfr	  IAPKEY  = 0xF1;	//IAP�����Ĵ���

/*UART*/
sfr   SCON    = 0X98;  	//���ڿ��ƼĴ���
sfr   SBUF    = 0X99;  	//�������ݻ���Ĵ���

/*option*/
sfr   OPINX   = 0XFE;
sfr   OPREG   = 0XFF;

///* ------------------- λ�Ĵ���-------------------- */

/*PSW*/
sbit  CY   = PSW^7;	    //��־λ		0:�ӷ��������λ�޽�λ�����߼����������λ�޽�λʱ		1:�ӷ��������λ�н�λ�����߼����������λ�н�λʱ
sbit  AC   = PSW^6;	    //��λ������־λ	0:�޽�λ����λ		1:�ӷ�����ʱ��bit3λ�н�λ�������������bit3λ�н�λʱ
sbit  F0   = PSW^5;	    //�û���־λ
sbit  RS1  = PSW^4;	    //�����Ĵ�����ѡ��λ
sbit  RS0  = PSW^3;	    //�����Ĵ�����ѡ��λ
sbit  OV   = PSW^2;	    //�����־λ
sbit  P	   = PSW^0;	    //��ż��־λ	0:ACC��1�ĸ���Ϊż��������0����		1:ACC��1�ĸ���Ϊ����

/*T2CON*/
sbit  TF2	= T2CON^7;
sbit  EXF2	= T2CON^6;
sbit  RCLK	= T2CON^5;
sbit  TCLK	= T2CON^4;
sbit  EXEN2	= T2CON^3;
sbit  TR2	= T2CON^2;
sbit  T2    = T2CON^1;
sbit  CP	= T2CON^0;


/*IP*/
sbit 	IPADC	= IP^6;	  //ADC�ж����ȿ���λ      0:�趨 ADC���ж�����Ȩ�� ���͡�		1:�趨 ADC���ж�����Ȩ�� ���ߡ�
sbit	IPT2	= IP^5;	  //Timer2�ж����ȿ���λ   0:�趨 Timer2���ж�����Ȩ�� ���͡�		1:�趨Timer2���ж�����Ȩ�� ���ߡ�
sbit 	IPUART	= IP^4;	  //UART�ж����ȿ���λ	   0:�趨UART���ж�����Ȩ�� ���͡�		1:�趨UART���ж�����Ȩ�� ���ߡ�
sbit 	IPT1	= IP^3;	  //Timer1�ж����ȿ���λ   0:�趨 Timer 1���ж�����Ȩ�� ���͡�	1:�趨 Timer 1���ж�����Ȩ�� ���ߡ�		    1:�趨INT0���ж�����Ȩ�� ���ߡ�
sbit 	IPT0	= IP^1;	  //Timer0�ж����ȿ���λ   0:�趨 Timer 0���ж�����Ȩ�� ���͡�	1:�趨 Timer 0���ж�����Ȩ�� ���ߡ�
sbit	IPINT0	= IP^0;   //INT0�ж����ȿ���λ	   0:�趨INT0�ж�����Ȩ�� ���͡�		    1:�趨INT1���ж�����Ȩ�� ���ߡ�

/*IE*/
sbit 	EA	  = IE^7;	  //�ж�ʹ�ܵ��ܿ���	0:�ر����е��ж�	1:�����е��ж�
sbit 	EADC  = IE^6;	  //ADC�ж�ʹ�ܿ���	    0:�ر�ADC�ж�		1:��ADC�ж�
sbit 	ET2   = IE^5;	  //Timer2�ж�ʹ�ܿ���	0:�ر�Timer2�ж�    1:��Timer2�ж�
sbit	EUART = IE^4;	  //UART�ж�ʹ�ܿ���	0:�ر�UART�ж�		1:��UART�ж�
sbit 	ET1   = IE^3;	  //Timer1�ж�ʹ�ܿ���	0:�ر�TIMER1�ж�	1:��TIMER1�ж�
sbit 	ET0	  = IE^1;	  //Timer0�ж�ʹ�ܿ���	0:�ر�TIMER0�ж�	1:��TIMER0�ж�
sbit	EINT0 = IE^0;	  //INT0�ж�ʹ�ܿ���	0:�ر�INT1�ж�      1:��INT1�ж�

/*TCON*/
sbit 	TF1	= TCON^7;	//T1����ж������־λ	T1��������������ж�ʱ��Ӳ����TF1��Ϊ��1���������жϣ�CPU��Ӧʱ��Ӳ���塰0����
sbit 	TR1	= TCON^6;	//��ʱ��T1�����п���λ	0:Timer1��ֹ����		1:Timer1��ʼ����
sbit 	TF0	= TCON^5;	//T0����ж������־λ	T0��������������ж�ʱ��Ӳ����TF0��Ϊ��1���������жϣ�CPU��Ӧʱ��Ӳ���塰0����
sbit 	TR0	= TCON^4;	//��ʱ��T0�����п���λ	0:Timer0��ֹ����		1:Timer0��ʼ����

/*SCON*/
sbit	SM0	= SCON^7;
sbit	SM1	= SCON^6;
sbit	SM2	= SCON^5;
sbit	REN	= SCON^4;
sbit	TB8	= SCON^3;
sbit	RB8	= SCON^2;
sbit	TI	= SCON^1;
sbit	RI	= SCON^0;

/******************* P0 ******************
*SC92F7252��װδ�����Ĺܽţ���
*SC92F7251��װδ�����Ĺܽţ�P04/P05
*SC92F7250��װδ�����Ĺܽţ�P0
******************************************/
sbit 	P05	= P0^5;
sbit 	P04	= P0^4;
sbit 	P03	= P0^3;
sbit 	P02	= P0^2;
sbit 	P01	= P0^1;
sbit 	P00	= P0^0;

/******************* P1 ******************
*SC92F7252��װδ�����Ĺܽţ���
*SC92F7251��װδ�����Ĺܽţ���
*SC92F7250��װδ�����Ĺܽţ�P10/P11/P16/P17
******************************************/
sbit 	P17	= P1^7;
sbit 	P16	= P1^6;
sbit 	P13	= P1^3;
sbit 	P12	= P1^2;
sbit 	P11	= P1^1;
sbit 	P10	= P1^0;

/******************* P2 ******************
*SC92F7252��װδ�����Ĺܽţ���
*SC92F7251��װδ�����Ĺܽţ�P26/P27
*SC92F7250��װδ�����Ĺܽţ�P24/P25
******************************************/
sbit 	P27	= P2^7;
sbit 	P26	= P2^6;
sbit 	P25	= P2^5;
sbit 	P24	= P2^4;
sbit 	P21	= P2^1;
sbit 	P20	= P2^0;

/****************************************************************************
*ע�⣺��װδ�����Ĺܽţ�������Ϊǿ�������ģʽ
*ICѡ�ͣ��������ʹ�õ�IC�ͺ�,�ڳ�ʼ����IO�ں󣬵������Ӧ��δ�����ܽŵ�IO������;
*����ѡ��SC92F7252�����õ��ú궨�塣
*****************************************************************************/
#define  SC92F7251_NIO_Init()   {P0CON|=0xF0;P1CON|=0x30;P2CON|=0xCC;}  //SC92F7251��δ��������IO������
#define  SC92F7250_NIO_Init()   {P0CON|=0xFF;P1CON|=0xF3;P2CON|=0x3C;}  //SC92F7250��δ��������IO������

#endif